package com.superbytecode.cloud.common.model.module.annotation;

import com.superbytecode.cloud.common.model.IDict;

import javax.annotation.Nonnull;

/**
 * All rights Reserved, Designed By www.super-master.com
 *
 * @ProjectName: beacon-cloud
 * @Package: com.superbytecode.cloud.common.model.module
 * @ClassName: EnumTransformer
 * @Description: []
 * <p> </p>
 * @Author: [Lance Ting]
 * @Date: 2024/10/21 15:54
 * @Version: V1.0
 * @Copyright: 2024 www.super-master.cn Inc. All rights reserved.
 * TODO: 注意,本文件Lance Ting所作,如果转载或使用请标明具体出处!
 **/
public class EnumTransformer<T> implements Transformer<T, TransformEnum> {

    /**
     * 转换
     *
     * @param enumCode   枚举编码
     * @param annotation 自定义注解
     * @return 转换后的值
     */
    @Override
    @SuppressWarnings("all")
    public String transform(@Nonnull T enumCode, @Nonnull TransformEnum annotation) {
        return IDict.obtainValueByCode((Class<? extends IDict<T>>) annotation.value(), enumCode);
    }
}